package com.cn.algorithm.two.union;

public class UnionFind_QU_R_PH extends UnionFind_QU_R{


    public UnionFind_QU_R_PH(int capacity) {
        super(capacity);
    }

    @Override
    int find(int v) {
        checkIndex(v);
        while (parent[v] != v) {
            parent[v] = parent[parent[v]];
            v = parent[v];
        }
        return parent[v];
    }
}
